//
//  JLXXPhotosController.m
//  JLXXBase
//
//  Created by apple on 17/5/16.
//  Copyright © 2017年 cnsuer. All rights reserved.
//

#import "JLXXPhotosController.h"
#import "JLXXMineProductionDataSource.h"
#import "JLXXMinePhotosDataManager.h"
#import "JLXXMineGetProduction.h"
#import "JLXXMinePhoto.h"
@interface JLXXPhotosController ()

@end

@implementation JLXXPhotosController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.collectionView yzgStartRefreshing];
}

- (void)createDataSourceAndLayout{
    self.dataSource = [[JLXXMineProductionDataSource alloc] initWithController:self];
    
    [self.dataSource addSectionItemOfCount:1];
    
    CGFloat margin = 5.0;
    YZGCollectionViewFlowLayout *layout = [[YZGCollectionViewFlowLayout alloc] initWithRowSpacing:margin columnSpacing:margin];
    self.layout = layout;
    
    self.cellClassName = @[@"JLXXMineProductionCollectionCell"];
    
}
-(void)createDataManager{
    self.listDataManager = [[JLXXMinePhotosDataManager alloc] initWithDelegate:self];
}
-(void)createRequest{
    JLXXMineGetProduction *getProduction = [[JLXXMineGetProduction alloc] initWithUserid:@"100000" type:@"1"];
    self.listDataManager.netRequest = getProduction;
}

-(void)requestDidSuccess{
    YZGCollectionSectionItem *sectionItem0 = [self.dataSource sectionItemForSection:0];
    [sectionItem0.rowItems addObjectsFromArray:self.listDataManager.responseObject];
    [self.collectionView reloadData];
}
-(void)didSelectItem:(id)item atIndexPath:(NSIndexPath *)indexPath{
    JLXXMinePhotosDataManager *photosDataManager = (JLXXMinePhotosDataManager *)self.listDataManager;
    
    NSLog(@"photoUrls:%@---currentIndex%d",photosDataManager.photoUrls,(int)indexPath.row);

}

-(void)yzgCollectionCell:(YZGCollectionCell *)cell clickButtons:(NSArray<UIButton *> *)buttons cellItem:(id)item{
    NSLog(@"操作");
}


@end
